

Component({
    properties: {
        cates:{type:Array, value:[]},
    },
    lifetimes: {
        attached() {

        }
    },
    data: {
        twoIndex: -1,
        threeIndex:-1
    },
    methods: {

        twoChange(e){
            const {cates} = this.data
            const {twoIndex} = e.currentTarget.dataset


            this.setData({
                twoIndex,
                threeIndex:-1,
            })
            this.triggerEvent('twoChange', {
                twoIndex,
                twoCate:cates[twoIndex],
            })
        },
        threeChange(e){
            const {cates} = this.data
            const {twoIndex, threeIndex} = e.currentTarget.dataset
            const twoCate = cates[twoIndex]
            const threeCate = cates[twoIndex]['child'][threeIndex]

            this.setData({
                twoIndex,
                threeIndex,
            })

            this.triggerEvent('threeChange', {
                twoIndex,
                threeIndex,
                twoCate,
                threeCate,
            })
        }

    }
});
